/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

package com.huawei.housekeeper.dao.entity;

import com.huawei.housekeeper.common.entity.BaseEntity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

import lombok.Getter;
import lombok.Setter;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * 功能描述
 *
 * @author y84241604
 * @since 2022-02-15
 */
@Getter
@Setter
@TableName("message")
public class Message extends BaseEntity {

    /**
     * 用户id
     */
    @TableField("user_id")
    private String userId;

    /**
     * 消息标题
     */
    @TableField("title")
    private String title;

    /**
     * 具体内容
     */
    @TableField("content")
    private String content;

    /**
     * 连接
     */
    @TableField("link")
    private String link;

    /**
     * 信息状态 0 未读,1 已读,2 删除
     */
    @TableField("message_status")
    private int messageStatus;

    /**
     * 来自
     */
    @TableField("info_from")
    private String infoFrom;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Message message = (Message) o;

        return new EqualsBuilder().appendSuper(super.equals(o))
            .append(messageStatus, message.messageStatus)
            .append(userId, message.userId)
            .append(title, message.title)
            .append(content, message.content)
            .append(link, message.link)
            .append(infoFrom, message.infoFrom)
            .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37).appendSuper(super.hashCode())
            .append(userId)
            .append(title)
            .append(content)
            .append(link)
            .append(messageStatus)
            .append(infoFrom)
            .toHashCode();
    }
}
